package top.lfyao.designpattern.details.decorator;

/**
 * 装饰模式客户端调用代码，装饰的过程更像层层包装，用前面的对象装饰后面的对象
 */
public class DecoratorClient {
    public static void main(String[] args){
        ConcreteComponent concreteComponent = new ConcreteComponent();
        ConcreteDecoratorA concreteDecoratorA = new ConcreteDecoratorA();
        ConcreteDecoratorB concreteDecoratorB = new ConcreteDecoratorB();
        ConcreteDecoratorC concreteDecoratorC = new ConcreteDecoratorC();
        concreteDecoratorA.setComponent(concreteComponent);
        concreteDecoratorC.setComponent(concreteDecoratorA);
        concreteDecoratorB.setComponent(concreteDecoratorC);
        concreteDecoratorB.operation();
    }
}
